package com.lgcns.weather.info;

import com.lgcns.weather.util.Util;

/**
 * 현재 날씨 정보를 가지고 있는 클래스
 */
public class CurrentInfo {
    private boolean ok;
    private String year;
    private String month;
    private String day;
    private String hour;
    private String icon;
    private String description;
    private String temperature;
    private String rainFall;

    public CurrentInfo() {
        this.ok = true;
    }
    
    /**
     * 기상 정보 발표 시간을 반환한다.
     * @return
     */
    public String getUpdateDate() {
        return Util.formatTimeString(year + month + day + hour);
    }

    /**
     * 별도로 세팅하지 않으면 default는 true 임.
     * 
     * @return
     */
    public boolean isOk() {
        return ok;
    }

    public void setOk(boolean ok) {
        this.ok = ok;
    }

    public String getYear() {
        return year;
    }

    public void setYear(String year) {
        this.year = year;
    }

    public String getMonth() {
        return month;
    }

    public void setMonth(String month) {
        this.month = month;
    }

    public String getDay() {
        return day;
    }

    public void setDay(String day) {
        this.day = day;
    }

    public String getHour() {
        return hour;
    }

    public void setHour(String hour) {
        this.hour = hour;
    }

    /**
     * 날씨 아이콘 코드(01 ~ ?) 
     * @return
     */
    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getTemperature() {
        return temperature;
    }

    public void setTemperature(String temperature) {
        this.temperature = temperature;
    }

    public String getRainFall() {
        return rainFall;
    }

    public void setRainFall(String rainFall) {
        if(rainFall == null || rainFall.trim().equals("")) {
            rainFall = "0";
        }
        this.rainFall = rainFall;
    }

    @Override
    public String toString() {
        return "CurrentWeatherInfo [day=" + day + ", description=" + description + ", hour=" + hour
                + ", icon=" + icon + ", month=" + month + ", ok=" + ok + ", rainFall=" + rainFall
                + ", temperature=" + temperature + ", year=" + year + "]";
    }
}
